java script converting text to slug

81

java script converting text to slug -

function convertToSlug(Text)
{
    return Text
        .toLowerCase()
        .replace(/ /g,'-')
        .replace(/[^\w-]+/g,'')
        ;
}

Comments

Submit
0 Comments